 
#include<stdio.h>
int main()
{
	int n,i,a,j,m,k;
	int sum1[101];
	int sum2[101];
	int right = 0,cuo = 0;
	
	scanf("%d", &n);
	for (i=0;i<n;i++){
		scanf("%d", &sum1[i]);
	                }
	
	scanf("%d", &k);
	    for (j = 0; j < k; j++) {
		    i = 0;
            cuo= 0; 
            right =0;
		
        for (m = 0; m < n; m++) {
			scanf("%d", &sum2[m]);
			
			if (sum2[m] == 0) {
                i++;
				continue;
			                 }
			
        if (sum1[i] == sum2[m]) 
				right++;
			                       
			else 
				cuo++;
			     	
            i++;
		                       }
		
		
		if (cuo == 0 && right >= 1) 
			printf("Da Jiang!!!\n");
		                              
		else 
			printf("Ai Ya\n");
		     
	                       }
	return 0;
}
